<template>
	<div>

		<div :class="['top',white?'whi':'']">
			<div class="backboxs" @click="goesBack">
				<img class="imgIcon"  :src='goes?imgs1:imgs2'  alt="">
				<span class="back" :style="goes?'':'color:#fff'">返回</span>
			</div>
		</div>
	</div>

</template>

<script>
import ls from 'store2'
	export default {
		props: {
			white: {
				type: Boolean,
				default: false
			},
			goes: {
				type: Boolean,
				default: true
			},

			gos: String,
			routeName: String,
			aa: String,
			bb: String
		},
		data() {
			return {
				show: false,
				imgs1:require('~/static/iconsvgs/top_icon_back.png'),
				imgs2:require('~/static/images/top_icon_back1.png')
			};
		},
		computed: {

		},
		destroyed() {
			// window.removeEventListener('popstate', this.fun, false);
		},
		mounted: function() {
			// if (this.commonJs.isTerminal() == 'isAndroid') {
			// 	if (window.history && window.history.pushState) {
			// 		history.pushState(null, null, document.URL);
			// 		window.addEventListener('popstate', this.fun, false); //false阻止默认事件 
			// 	}
			// };
			// if (ls.get('backUrl') == '../matriculate/history' || ls.get('backUrl') == '../matriculate/indexs') {
			// 	ls.remove('history');
			// }

		},
		methods: {
			goesBack(){
				
				if(this.aa){
					this.fun()
				}else{
					this.$router.back()
				}
			},
			fun() {
				this.$router.replace({
					path: this.aa,
					query: {
						type: this.bb
					}
				})
			}

		}
	};
</script>


<style scoped lang="less">
	.top {
		width: 100%;
		height: 0.8rem;
		line-height: 0.8rem;
		padding: 0.2rem 0.3rem;
		box-sizing: border-box;
		display: flex;
		justify-content: flex-start;
		align-items: center;
		.backboxs {
			display: flex;
			justify-content: flex-start;
			align-items: center;
			width: 3rem;
			height: 0.8rem;
			padding: 0.2rem 0;
		}
		.imgIcon {
			width: 0.4rem;
			height: 0.4rem;
			vertical-align: middle;
		}

		.back {
			display: inline-block;
			margin-left: 0.1rem;
			font-weight: bold;
			color: #222;
			vertical-align: middle;
		
		}

	}

	.whi {
		background: #fff;
	}
</style>
